const app = getApp();
import {
  postRequest,
  getRequest,
  postParamsRequest
} from '../../api/request';
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    type: {
      type: null,
      value: 1
    },
    ids: {
      type: null,
      value: '1',
      observer(newVal) {
        console.log('传进来的id：', newVal);
        if (newVal) {
          // fetchApi(this, {
          //   url: 'category/getgoodsListByIds',
          //   data: {
          //     goodsIds: newVal,
          //     goodsType: 1
          //   }
          // }).then(res => {
          //   var goodsList = res.data.data.map(i => { i.thumb = i.thumb_url; return i; })
          //   this.setData({
          //     goodsList: goodsList
          //   })
          // }).catch(err => {
          // }) 
          postParamsRequest("/api/goods/querySimpleGoodsList", {
            goodsId: newVal
          }).then((res) => {
            console.log(res.data.data);
              this.setData({
                goodsList: res.data.data
              })
          }).catch((err) => {});
        }
      }
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    goodsList: []
  },

  attached() {

  },
  methods: {

  },
  onLoad(options) {

  }
})